{% extends 'rebs/layouts/base.html' %}


{% block title %}Rebs - 계약 내역 조회{% endblock %}

{% block content %}
    {% load static humanize mathfilters %}

    <!-- Start Content-->
    <div class="container-fluid">

        <!-- start page title -->
        {% include 'rebs/partials/content_title.html' with  second_bs="분양 계약 관리" title="동호수 현황표" %}
        <!-- end page title -->

        <div class="row">
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-body">

                        {% with menu_order='4' %}
                            {% include 'rebs_contract/partials/head_menu.html' %}
                        {% endwith %}

                        <form class="form-horizontal p-0 col-12" method="get">

                            <div class="row">
                                {% include 'rebs/partials/project_select.html' %}
                                <div class="col-sm-12 col-md-6"></div>
                            </div>

                        </form>
                    </div>
                </div>
            </div>

            <div class="col-lg-12">
                <div class="card">
                    <div class="card-body pb-1">
                        <div class="row">
                            <div class="col-md-6 table-responsive">
                                <table class="table table-bordered table-sm">
                                    <tbody>
                                    <tr>
                                        <td class="bg-light" style="width: 25%">총세대수</td>
                                        <td class="text-right"
                                            style="width: 25%">{{ unit_numbers.count|default:"-"|intcomma }}</td>
                                        <td class="bg-light text-black-50" style="width: 25%">홀딩세대</td>
                                        <td class="text-right"
                                            style="width: 25%">{{ is_hold.count|default:"-"|intcomma }}</td>
                                    </tr>
                                    <tr>
                                        <td class="bg-success-lighten">청약세대</td>
                                        <td class="text-right">{{ is_apply.count|default:"-"|intcomma }}</td>
                                        <td class="bg-primary-lighten">계약세대</td>
                                        <td class="text-right">{{ is_contract.count|default:"-"|intcomma }}</td>
                                    </tr>
                                    <tr>
                                        <td class="bg-light">합계</td>
                                        <td class="text-right">{{ is_apply.count|add:is_contract.count|default:"-"|intcomma }}</td>
                                        <td class="bg-light">잔여세대</td>
                                        <td class="text-right">{{ unit_numbers.count|sub:is_apply.count|sub:is_contract.count|default:"-"|intcomma }}</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div class="col">
                                {% for type in types %}
                                    <i class="mdi mdi-square" style="color: {{ type.color }};"></i> {{ type }}
                                    &nbsp;&nbsp;&nbsp;
                                {% endfor %}
                            </div>

                        </div>
                        <div class="col-sm text-right mr-2">
                            <a href="javascript:alert('준비중입니다!')" class="ml-3 text-black-50">
                                <i class="mdi mdi-file-excel-box"></i> Excel Export
                                <i class="mdi mdi-download ml-1"></i>
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-lg-12">
                <div class="card">
                    <div class="card-body">
                        <div class="row">
                            {% include 'rebs_contract/partials/unit_number_graph.html' %}
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div> <!-- container -->

{% endblock %}

{% block third_party_js %}
    <script>
      window.onload = function () {
        document.getElementById('id_project_sel').setAttribute('onchange', 'submit()')
      }
    </script>
{% endblock %}
